<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
  <head>
    <base href="<%=basePath%>">
    <title>生成试卷</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<link rel="stylesheet" type="text/css" href="css/main.css" />
	
	<script type="text/javascript">
	function addCoverage() {
		var coverageNum=Number(document.getElementById('count').value);
		if(coverageNum<10)
		{
			coverageNum++;
			newDiv=document.createElement("div");
			newDiv.id="divCoverage"+coverageNum;
			document.getElementById('coverage').appendChild(newDiv);
			document.getElementById('count').value=coverageNum;
			newDiv.innerHTML="<select name='chapter_"+coverageNum+"'>"
							+"<option value='0' selected></option>"
							+"<c:forEach items='${chapterList}' var='chapter'>"
							+"<option value='${chapter.id}'>"
							+"${chapter.name}"
							+"</option>"
							+"</c:forEach>"
							+"</select> 占: "
							+"<input type='text' name='percent_"+coverageNum+"' size='2'/>%";
		}
	}
	function minusCoverage(){
		var coverageNum = Number(document.getElementById('count').value);
		if(coverageNum > 1){
			targetDiv = document.getElementById("divCoverage"+coverageNum);
			document.getElementById('coverage').removeChild(targetDiv);
			coverageNum--;
			document.getElementById('count').value = coverageNum;
		}
	}
	</script>
  </head>
  
  <body>
  	<%@ include file="header.jsp" %>
    
    <DIV id=tips>
		<P class=tips_left>
			您的位置：<A>首页</A> 
			&gt;&gt; <A>考试管理</A>
			&gt;&gt; <A>生成试卷</A>
		</P>
	</DIV>
		
	<DIV id=container>
		<DIV id=list_left>
			<%@ include file="left_exam.jsp" %>
		</DIV>
		<DIV id=list_right>
			<DIV id=subnav>
				<UL class=subnav_ul1></UL>
				<UL class=subnav_ul2>
					<DIV class=subnav_t>
						<P class=subnav_tl>生成试卷</P>
  						<P class=subnav_tr></P>
  					</DIV>
  					<DIV class=subnav_nr>
  						<form id="addNewExam" name="addNewExam" action="teacher/makeUpPaper.html?examID=${examID}" method="post">
							<table width="600" align="center" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td class=error_message colspan="3">${error_param}</td>
					            </tr>
								<tr>
									<td class="row_name" width="15%">试卷标题：</td>
					                <td class="row_content" width="45%">
					                	<input type="text" name="title" value="${title}"/>
					                </td>
					                <td class=error_message>* ${error_title}</td>
					            </tr>
					            <tr>
									<td class="row_name">覆盖率：</td>
					                <td class="row_content">
					                	<div id="coverage">
						                	<select name="chapter_1">
						                		<option value='0'></option>
												<c:forEach items="${chapterList}" var="chapter">
												<option value="${chapter.id}">
													${chapter.name}
												</option>
												</c:forEach>
											</select> 占:
						                	<input type="text" name="percent_1" size="2"/>%
					                	</div>
					                	<input type="hidden" id="count" name="count" value="1" />
					                	<input type="button" value=" 增 " onClick="javascript:addCoverage()" />
					                	<input type="button" value=" 减 " onClick="javascript:minusCoverage()" />
					               </td>
					               <td class=error_message>* ${error_coverage}</td>
					            </tr>
								<tr>
					                <td class="row_name">平均难度：</td>
									<td class="row_content">
					            		<select name="difficulty">
											<option value="0"> </option>
											<option value="1" <c:if test="${difficulty == 1}">selected</c:if> > 1</option>
											<option value="2" <c:if test="${difficulty == 2}">selected</c:if> > 2</option>
											<option value="3" <c:if test="${difficulty == 3}">selected</c:if> > 3</option>
											<option value="4" <c:if test="${difficulty == 4}">selected</c:if> > 4</option>
											<option value="5" <c:if test="${difficulty == 5}">selected</c:if> > 5</option>
											<option value="6" <c:if test="${difficulty == 6}">selected</c:if> > 6</option>
											<option value="7" <c:if test="${difficulty == 7}">selected</c:if> > 7</option>
											<option value="8" <c:if test="${difficulty == 8}">selected</c:if> > 8</option>
											<option value="9" <c:if test="${difficulty == 9}">selected</c:if> > 9</option>
							            </select>
					                </td>
					                <td class=error_message>* ${error_difficulty}</td>
					            </tr>
								<tr>
					                <td class="row_name">判断题数量：</td>
									<td class="row_content">
										<input type="text" name="panduan_num" value="${panduan_num}"/> (1-99)
									</td>
									<td class=error_message>* ${error_panduan_num}</td>
								</tr>
								<tr>
					                <td class="row_name">选择题数量：</td>
					                <td class="row_content">
					                	<input type="text" name="xuanze_num" value="${xuanze_num}"/> (1-99)
					                </td>
					                <td class=error_message>* ${error_xuanze_num}</td>
					            </tr>
								<tr>
					                <td class="row_name">填空题数量：</td>
					                <td class="row_content">
					                	<input type="text" name="tiankong_num" value="${tiankong_num}" /> (1-99)
					                </td>
					                <td class=error_message>* ${error_tiankong_num}</td>
					            </tr>
								<tr>
					                <td class="row_name">总分：</td>
									<td class="row_content">
										<input type="text" name="total_score" value="${total_score}"/> (1-999)
									</td>
									<td class=error_message>* ${error_total_score}</td>
								</tr>
					            <tr>
					                <td colspan="2"><hr/></td>
					                <td></td>
					            </tr>
					            <tr>
					                <td class="row_name">附加分：</td>
					                <td class="row_content">
					                	<input type="text" name="extra_score" disabled="disabled"/>（暂时未启用）
					                </td>
					                <td class=error_message></td>
					            </tr>
					            <tr>
					                <td class="row_name">主观题数量：</td>
					                <td class="row_content">
					                	<input type="text" name="zhuguan_num" disabled="disabled" />（暂时未启用）
					                </td>
					                <td class=error_message></td>
					            </tr>
					            <tr>
					                <td class="row_name">备注：</td>
						          	<td class="row_content">
						          		<textarea name="remark" rows="4" cols="17">${remark}</textarea>
									</td>
									<td class=error_message>${error_remark}</td>
					            </tr>
					    		<tr>
									<td class="row_name"></td>
						          	<td class="row_submit"><input type="submit" value=" 提 交 "></td>
					            </tr>
							</table>
					      </form>
					</DIV>
				</UL>
				<UL class=subnav_ul3></UL>
			</DIV>
		</DIV>
	</DIV>

    <%@ include file="../footer.jsp" %>
  </body>
</html>
